package cn.bugstack.domain.trade.adapter;

import cn.bugstack.domain.trade.model.aggregate.GroupBuyOrderAggregate;
import cn.bugstack.domain.trade.model.aggregate.GroupBuyTeamSettlementAggregate;
import cn.bugstack.domain.trade.model.entity.GroupBuyActivityEntity;
import cn.bugstack.domain.trade.model.entity.GroupBuyTeamEntity;
import cn.bugstack.domain.trade.model.entity.MarketPayOrderEntity;
import cn.bugstack.domain.trade.model.entity.NotifyTaskEntity;
import cn.bugstack.domain.trade.model.valobj.GroupBuyProgressVO;

import java.util.List;

public interface ITradeRepository {


    MarketPayOrderEntity queryNoPayMarketPayOrderByOutTradeNo(String userId, String outTradeNo);

    GroupBuyProgressVO queryGroupBuyProgress(String teamId);


    MarketPayOrderEntity lockMarketPayOrder(GroupBuyOrderAggregate groupBuyOrderAggregate);

    GroupBuyActivityEntity queryGroupBuyActivityByActivityId(Long activityId);

    Integer queryOrderCountByActivityId(Long activityId, String userId);


    GroupBuyTeamEntity queryGroupBuyByTeamId(String teamId);


    /**
     * 结算动作
     * @param groupBuyTeamSettlementAggregate
     */
    void settlementMarketPayOrder(GroupBuyTeamSettlementAggregate groupBuyTeamSettlementAggregate);


    boolean isSCBlackIntercept(String source, String channel);

    List<NotifyTaskEntity> queryUnexecutedNotifyTaskList(String teamId);

    int updateNotifyTaskStatsSuccess(String teamId);

    int updateNotifyTaskStatsError(String teamId);

    int updateNotifyTaskStatsRetry(String teamId);
}
